function t(t) {
    return t && t.__esModule ? t : {
        default: t
    };
}

var a = t(require("../../utils/api")), e = t(require("../../../utils/config")), i = getApp();

Page({
    data: {
        MAX_WORD_COUNT: 40
    },
    onLoad: function() {
        var t = i.globalData, a = t.tokens.realname, e = t.card, l = e.cardid, o = e.autoreply, r = void 0 === o ? "" : o, d = "您好，我是" + a + "，欢迎访问我的小名片！";
        this.cardid = l, this.setData({
            autoreply: r,
            placeholder: d,
            content: r,
            valLength: r.length
        });
    },
    onInput: function(t) {
        var a = t.detail.value;
        this.setData({
            valLength: a.length,
            autoreply: a.trim()
        });
    },
    submit: function(t) {
        var e = this.data.autoreply;
        this.collectFormId(t), a.default.chat.setting.setautoreply({
            data: {
                autoreply: e,
                cardid: this.cardid
            }
        }).then(function() {
            i.globalData.card.autoreply = e, wx.showToast({
                title: "保存成功"
            }), setTimeout(function() {
                wx.navigateBack();
            }, 800);
        });
    },
    collectFormId: function(t, i) {
        var l = getApp().globalData.appid;
        a.default.weapp.collectformid({
            data: {
                formid: t.detail.formId,
                app: e.default.WX_APP_NAME,
                appid: l
            }
        });
    }
});